package com.ilxqx.framework.security.controller;

import com.ilxqx.framework.security.validation.GeeTestValidation;
import com.ilxqx.framework.security.validation.Validation;
import com.ilxqx.framework.util.ResultUtils;
import com.ilxqx.framework.vo.ResultVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 极验控制器
 * @author venus
 */
@Api("极验控制器")
@RestController
@Slf4j
@RequestMapping("${framework.gee-test.challenge-code-url}")
public class GeeTestController {

	private final Validation geeTestValidation;

	@Autowired
	public GeeTestController(GeeTestValidation geeTestValidation) {
		this.geeTestValidation = geeTestValidation;
	}

	@GetMapping
	public ResultVO getChallengeCode(HttpServletRequest request) {
		return ResultUtils.success("成功", this.geeTestValidation.challenge(request));
	}

}
